package cn.kgc.springboot03.service.impl;

import cn.kgc.springboot03.entity.Emp;
import cn.kgc.springboot03.mapper.EmpMapper;
import cn.kgc.springboot03.service.EmpService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: mosin
 * @version: v1.0  2022/12/27
 */
@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpMapper empMapper;
    @Override
    public List<Emp> empList() {

        List<Emp> emps = empMapper.empList();
        return emps;
    }

    @Override
    public List<Emp> getPage(Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<Emp> emps = empMapper.empList();
        PageInfo<Emp> empPageInfo = new PageInfo<>(emps);
        List<Emp> list = empPageInfo.getList();
        return list;
    }
}
